

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>prml.linear package &mdash; prml  documentation</title>
  

  
  
  
  

  
  <script type="text/javascript" src="_static/js/modernizr.min.js"></script>
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
        <script type="text/javascript" src="_static/jquery.js"></script>
        <script type="text/javascript" src="_static/underscore.js"></script>
        <script type="text/javascript" src="_static/doctools.js"></script>
        <script type="text/javascript" src="_static/language_data.js"></script>
        <script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
    
    <script type="text/javascript" src="_static/js/theme.js"></script>

    

  
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="prml.markov package" href="prml.markov.html" />
    <link rel="prev" title="prml.kernel package" href="prml.kernel.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="index.html" class="icon icon-home"> prml
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="prml.html">prml package</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="prml.html#subpackages">Subpackages</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="prml.bayesnet.html">prml.bayesnet package</a></li>
<li class="toctree-l3"><a class="reference internal" href="prml.clustering.html">prml.clustering package</a></li>
<li class="toctree-l3"><a class="reference internal" href="prml.dimreduction.html">prml.dimreduction package</a></li>
<li class="toctree-l3"><a class="reference internal" href="prml.kernel.html">prml.kernel package</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">prml.linear package</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#submodules">Submodules</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-prml.linear.bayesian_logistic_regression">prml.linear.bayesian_logistic_regression module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-prml.linear.bayesian_regression">prml.linear.bayesian_regression module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-prml.linear.classifier">prml.linear.classifier module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-prml.linear.emprical_bayes_regression">prml.linear.emprical_bayes_regression module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-prml.linear.fishers_linear_discriminant">prml.linear.fishers_linear_discriminant module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-prml.linear.least_squares_classifier">prml.linear.least_squares_classifier module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-prml.linear.linear_regression">prml.linear.linear_regression module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-prml.linear.logistic_regression">prml.linear.logistic_regression module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-prml.linear.perceptron">prml.linear.perceptron module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-prml.linear.regression">prml.linear.regression module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-prml.linear.ridge_regression">prml.linear.ridge_regression module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-prml.linear.softmax_regression">prml.linear.softmax_regression module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-prml.linear.variational_linear_regression">prml.linear.variational_linear_regression module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-prml.linear.variational_logistic_regression">prml.linear.variational_logistic_regression module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-prml.linear">Module contents</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="prml.markov.html">prml.markov package</a></li>
<li class="toctree-l3"><a class="reference internal" href="prml.nn.html">prml.nn package</a></li>
<li class="toctree-l3"><a class="reference internal" href="prml.preprocess.html">prml.preprocess package</a></li>
<li class="toctree-l3"><a class="reference internal" href="prml.rv.html">prml.rv package</a></li>
<li class="toctree-l3"><a class="reference internal" href="prml.sampling.html">prml.sampling package</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="prml.html#module-prml">Module contents</a></li>
</ul>
</li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">prml</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html">Docs</a> &raquo;</li>
        
          <li><a href="prml.html">prml package</a> &raquo;</li>
        
      <li>prml.linear package</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="_sources/prml.linear.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="prml-linear-package">
<h1>prml.linear package<a class="headerlink" href="#prml-linear-package" title="Permalink to this headline">¶</a></h1>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-prml.linear.bayesian_logistic_regression">
<span id="prml-linear-bayesian-logistic-regression-module"></span><h2>prml.linear.bayesian_logistic_regression module<a class="headerlink" href="#module-prml.linear.bayesian_logistic_regression" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="prml.linear.bayesian_logistic_regression.BayesianLogisticRegression">
<em class="property">class </em><code class="descclassname">prml.linear.bayesian_logistic_regression.</code><code class="descname">BayesianLogisticRegression</code><span class="sig-paren">(</span><em>alpha: float = 1.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/bayesian_logistic_regression.html#BayesianLogisticRegression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.bayesian_logistic_regression.BayesianLogisticRegression" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.logistic_regression.LogisticRegression" title="prml.linear.logistic_regression.LogisticRegression"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.logistic_regression.LogisticRegression</span></code></a></p>
<p>Logistic regression model</p>
<p>w ~ Gaussian(0, alpha^(-1)I)
y = sigmoid(X &#64; w)
t ~ Bernoulli(t|y)</p>
<dl class="method">
<dt id="prml.linear.bayesian_logistic_regression.BayesianLogisticRegression.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em>, <em>max_iter: int = 100</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/bayesian_logistic_regression.html#BayesianLogisticRegression.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.bayesian_logistic_regression.BayesianLogisticRegression.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>bayesian estimation of logistic regression model
using Laplace approximation</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training data independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – training data dependent variable
binary 0 or 1</li>
<li><strong>max_iter</strong> (<em>int</em><em>, </em><em>optional</em>) – maximum number of paramter update iteration (the default is 100)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.bayesian_logistic_regression.BayesianLogisticRegression.proba">
<code class="descname">proba</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/bayesian_logistic_regression.html#BayesianLogisticRegression.proba"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.bayesian_logistic_regression.BayesianLogisticRegression.proba" title="Permalink to this definition">¶</a></dt>
<dd><p>compute probability of input belonging class 1</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training data independent variable</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">probability of positive</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N,) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-prml.linear.bayesian_regression">
<span id="prml-linear-bayesian-regression-module"></span><h2>prml.linear.bayesian_regression module<a class="headerlink" href="#module-prml.linear.bayesian_regression" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="prml.linear.bayesian_regression.BayesianRegression">
<em class="property">class </em><code class="descclassname">prml.linear.bayesian_regression.</code><code class="descname">BayesianRegression</code><span class="sig-paren">(</span><em>alpha: float = 1.0</em>, <em>beta: float = 1.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/bayesian_regression.html#BayesianRegression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.bayesian_regression.BayesianRegression" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.regression.Regression" title="prml.linear.regression.Regression"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.regression.Regression</span></code></a></p>
<p>Bayesian regression model</p>
<p>w ~ N(w|0, alpha^(-1)I)
y = X &#64; w
t ~ N(t|X &#64; w, beta^(-1))</p>
<dl class="method">
<dt id="prml.linear.bayesian_regression.BayesianRegression.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/bayesian_regression.html#BayesianRegression.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.bayesian_regression.BayesianRegression.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>bayesian update of parameters given training dataset</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>n_features</em><em>) </em><em>np.ndarray</em>) – training data independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – training data dependent variable</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.bayesian_regression.BayesianRegression.predict">
<code class="descname">predict</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>return_std: bool = False</em>, <em>sample_size: int = None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/bayesian_regression.html#BayesianRegression.predict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.bayesian_regression.BayesianRegression.predict" title="Permalink to this definition">¶</a></dt>
<dd><p>return mean (and standard deviation) of predictive distribution</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>n_features</em><em>) </em><em>np.ndarray</em>) – independent variable</li>
<li><strong>return_std</strong> (<em>bool</em><em>, </em><em>optional</em>) – flag to return standard deviation (the default is False)</li>
<li><strong>sample_size</strong> (<em>int</em><em>, </em><em>optional</em>) – number of samples to draw from the predictive distribution
(the default is None, no sampling from the distribution)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><ul class="simple">
<li><strong>y</strong> (<em>(N,) np.ndarray</em>) – mean of the predictive distribution</li>
<li><strong>y_std</strong> (<em>(N,) np.ndarray</em>) – standard deviation of the predictive distribution</li>
<li><strong>y_sample</strong> (<em>(N, sample_size) np.ndarray</em>) – samples from the predictive distribution</li>
</ul>
</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-prml.linear.classifier">
<span id="prml-linear-classifier-module"></span><h2>prml.linear.classifier module<a class="headerlink" href="#module-prml.linear.classifier" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="prml.linear.classifier.Classifier">
<em class="property">class </em><code class="descclassname">prml.linear.classifier.</code><code class="descname">Classifier</code><a class="reference internal" href="_modules/prml/linear/classifier.html#Classifier"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.classifier.Classifier" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Base class for classifiers</p>
</dd></dl>

</div>
<div class="section" id="module-prml.linear.emprical_bayes_regression">
<span id="prml-linear-emprical-bayes-regression-module"></span><h2>prml.linear.emprical_bayes_regression module<a class="headerlink" href="#module-prml.linear.emprical_bayes_regression" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="prml.linear.emprical_bayes_regression.EmpiricalBayesRegression">
<em class="property">class </em><code class="descclassname">prml.linear.emprical_bayes_regression.</code><code class="descname">EmpiricalBayesRegression</code><span class="sig-paren">(</span><em>alpha: float = 1.0</em>, <em>beta: float = 1.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/emprical_bayes_regression.html#EmpiricalBayesRegression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.emprical_bayes_regression.EmpiricalBayesRegression" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.bayesian_regression.BayesianRegression" title="prml.linear.bayesian_regression.BayesianRegression"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.bayesian_regression.BayesianRegression</span></code></a></p>
<p>Empirical Bayes Regression model
a.k.a.
type 2 maximum likelihood,
generalized maximum likelihood,
evidence approximation</p>
<p>w ~ N(w|0, alpha^(-1)I)
y = X &#64; w
t ~ N(t|X &#64; w, beta^(-1))
evidence function p(t|X,alpha,beta) = S p(t|w;X,beta)p(w|0;alpha) dw</p>
<dl class="method">
<dt id="prml.linear.emprical_bayes_regression.EmpiricalBayesRegression.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em>, <em>max_iter: int = 100</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/emprical_bayes_regression.html#EmpiricalBayesRegression.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.emprical_bayes_regression.EmpiricalBayesRegression.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>maximization of evidence function with respect to
the hyperparameters alpha and beta given training dataset</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – training dependent variable</li>
<li><strong>max_iter</strong> (<em>int</em>) – maximum number of iteration</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.emprical_bayes_regression.EmpiricalBayesRegression.log_evidence">
<code class="descname">log_evidence</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/emprical_bayes_regression.html#EmpiricalBayesRegression.log_evidence"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.emprical_bayes_regression.EmpiricalBayesRegression.log_evidence" title="Permalink to this definition">¶</a></dt>
<dd><p>logarithm or the evidence function</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – indenpendent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – dependent variable</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">log evidence</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">float</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-prml.linear.fishers_linear_discriminant">
<span id="prml-linear-fishers-linear-discriminant-module"></span><h2>prml.linear.fishers_linear_discriminant module<a class="headerlink" href="#module-prml.linear.fishers_linear_discriminant" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="prml.linear.fishers_linear_discriminant.FishersLinearDiscriminant">
<em class="property">class </em><code class="descclassname">prml.linear.fishers_linear_discriminant.</code><code class="descname">FishersLinearDiscriminant</code><span class="sig-paren">(</span><em>w: numpy.ndarray = None</em>, <em>threshold: float = None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/fishers_linear_discriminant.html#FishersLinearDiscriminant"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.fishers_linear_discriminant.FishersLinearDiscriminant" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.classifier.Classifier" title="prml.linear.classifier.Classifier"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.classifier.Classifier</span></code></a></p>
<p>Fisher’s Linear discriminant model</p>
<dl class="method">
<dt id="prml.linear.fishers_linear_discriminant.FishersLinearDiscriminant.classify">
<code class="descname">classify</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/fishers_linear_discriminant.html#FishersLinearDiscriminant.classify"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.fishers_linear_discriminant.FishersLinearDiscriminant.classify" title="Permalink to this definition">¶</a></dt>
<dd><p>classify input data</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – independent variable to be classified</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">binary class for each input</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N,) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.fishers_linear_discriminant.FishersLinearDiscriminant.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/fishers_linear_discriminant.html#FishersLinearDiscriminant.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.fishers_linear_discriminant.FishersLinearDiscriminant.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>estimate parameter given training dataset</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training dataset independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – training dataset dependent variable
binary 0 or 1</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.fishers_linear_discriminant.FishersLinearDiscriminant.transform">
<code class="descname">transform</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/fishers_linear_discriminant.html#FishersLinearDiscriminant.transform"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.fishers_linear_discriminant.FishersLinearDiscriminant.transform" title="Permalink to this definition">¶</a></dt>
<dd><p>project data</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – independent variable</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><strong>y</strong> – projected data</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N,) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-prml.linear.least_squares_classifier">
<span id="prml-linear-least-squares-classifier-module"></span><h2>prml.linear.least_squares_classifier module<a class="headerlink" href="#module-prml.linear.least_squares_classifier" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="prml.linear.least_squares_classifier.LeastSquaresClassifier">
<em class="property">class </em><code class="descclassname">prml.linear.least_squares_classifier.</code><code class="descname">LeastSquaresClassifier</code><span class="sig-paren">(</span><em>W: numpy.ndarray = None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/least_squares_classifier.html#LeastSquaresClassifier"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.least_squares_classifier.LeastSquaresClassifier" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.classifier.Classifier" title="prml.linear.classifier.Classifier"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.classifier.Classifier</span></code></a></p>
<p>Least squares classifier model</p>
<p>X : (N, D)
W : (D, K)
y = argmax_k X &#64; W</p>
<dl class="method">
<dt id="prml.linear.least_squares_classifier.LeastSquaresClassifier.classify">
<code class="descname">classify</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/least_squares_classifier.html#LeastSquaresClassifier.classify"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.least_squares_classifier.LeastSquaresClassifier.classify" title="Permalink to this definition">¶</a></dt>
<dd><p>classify input data</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – independent variable to be classified</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">class index for each input</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N,) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.least_squares_classifier.LeastSquaresClassifier.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/least_squares_classifier.html#LeastSquaresClassifier.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.least_squares_classifier.LeastSquaresClassifier.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>least squares fitting for classification</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) or </em><em>(</em><em>N</em><em>, </em><em>K</em><em>) </em><em>np.ndarray</em>) – training dependent variable
in class index (N,) or one-of-k coding (N,K)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-prml.linear.linear_regression">
<span id="prml-linear-linear-regression-module"></span><h2>prml.linear.linear_regression module<a class="headerlink" href="#module-prml.linear.linear_regression" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="prml.linear.linear_regression.LinearRegression">
<em class="property">class </em><code class="descclassname">prml.linear.linear_regression.</code><code class="descname">LinearRegression</code><a class="reference internal" href="_modules/prml/linear/linear_regression.html#LinearRegression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.linear_regression.LinearRegression" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.regression.Regression" title="prml.linear.regression.Regression"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.regression.Regression</span></code></a></p>
<p>Linear regression model
y = X &#64; w
t ~ N(t|X &#64; w, var)</p>
<dl class="method">
<dt id="prml.linear.linear_regression.LinearRegression.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/linear_regression.html#LinearRegression.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.linear_regression.LinearRegression.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>perform least squares fitting</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – training dependent variable</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.linear_regression.LinearRegression.predict">
<code class="descname">predict</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>return_std: bool = False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/linear_regression.html#LinearRegression.predict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.linear_regression.LinearRegression.predict" title="Permalink to this definition">¶</a></dt>
<dd><p>make prediction given input</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – samples to predict their output</li>
<li><strong>return_std</strong> (<em>bool</em><em>, </em><em>optional</em>) – returns standard deviation of each predition if True</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><ul class="simple">
<li><strong>y</strong> (<em>(N,) np.ndarray</em>) – prediction of each sample</li>
<li><strong>y_std</strong> (<em>(N,) np.ndarray</em>) – standard deviation of each predition</li>
</ul>
</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-prml.linear.logistic_regression">
<span id="prml-linear-logistic-regression-module"></span><h2>prml.linear.logistic_regression module<a class="headerlink" href="#module-prml.linear.logistic_regression" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="prml.linear.logistic_regression.LogisticRegression">
<em class="property">class </em><code class="descclassname">prml.linear.logistic_regression.</code><code class="descname">LogisticRegression</code><a class="reference internal" href="_modules/prml/linear/logistic_regression.html#LogisticRegression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.logistic_regression.LogisticRegression" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.classifier.Classifier" title="prml.linear.classifier.Classifier"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.classifier.Classifier</span></code></a></p>
<p>Logistic regression model</p>
<p>y = sigmoid(X &#64; w)
t ~ Bernoulli(t|y)</p>
<dl class="method">
<dt id="prml.linear.logistic_regression.LogisticRegression.classify">
<code class="descname">classify</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>threshold: float = 0.5</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/logistic_regression.html#LogisticRegression.classify"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.logistic_regression.LogisticRegression.classify" title="Permalink to this definition">¶</a></dt>
<dd><p>classify input data</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – independent variable to be classified</li>
<li><strong>threshold</strong> (<em>float</em><em>, </em><em>optional</em>) – threshold of binary classification (default is 0.5)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">binary class for each input</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">(N,) np.ndarray</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.logistic_regression.LogisticRegression.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em>, <em>max_iter: int = 100</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/logistic_regression.html#LogisticRegression.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.logistic_regression.LogisticRegression.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>maximum likelihood estimation of logistic regression model</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training data independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – training data dependent variable
binary 0 or 1</li>
<li><strong>max_iter</strong> (<em>int</em><em>, </em><em>optional</em>) – maximum number of paramter update iteration (the default is 100)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.logistic_regression.LogisticRegression.proba">
<code class="descname">proba</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/logistic_regression.html#LogisticRegression.proba"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.logistic_regression.LogisticRegression.proba" title="Permalink to this definition">¶</a></dt>
<dd><p>compute probability of input belonging class 1</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training data independent variable</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">probability of positive</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N,) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-prml.linear.perceptron">
<span id="prml-linear-perceptron-module"></span><h2>prml.linear.perceptron module<a class="headerlink" href="#module-prml.linear.perceptron" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="prml.linear.perceptron.Perceptron">
<em class="property">class </em><code class="descclassname">prml.linear.perceptron.</code><code class="descname">Perceptron</code><a class="reference internal" href="_modules/prml/linear/perceptron.html#Perceptron"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.perceptron.Perceptron" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.classifier.Classifier" title="prml.linear.classifier.Classifier"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.classifier.Classifier</span></code></a></p>
<p>Perceptron model</p>
<dl class="method">
<dt id="prml.linear.perceptron.Perceptron.classify">
<code class="descname">classify</code><span class="sig-paren">(</span><em>X</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/perceptron.html#Perceptron.classify"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.perceptron.Perceptron.classify" title="Permalink to this definition">¶</a></dt>
<dd><p>classify input data</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – independent variable to be classified</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">binary class (-1 or 1) for each input</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N,) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.perceptron.Perceptron.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X</em>, <em>t</em>, <em>max_epoch=100</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/perceptron.html#Perceptron.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.perceptron.Perceptron.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>fit perceptron model on given input pair</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>)</em>) – training dependent variable
binary -1 or 1</li>
<li><strong>max_epoch</strong> (<em>int</em><em>, </em><em>optional</em>) – maximum number of epoch (the default is 100)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-prml.linear.regression">
<span id="prml-linear-regression-module"></span><h2>prml.linear.regression module<a class="headerlink" href="#module-prml.linear.regression" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="prml.linear.regression.Regression">
<em class="property">class </em><code class="descclassname">prml.linear.regression.</code><code class="descname">Regression</code><a class="reference internal" href="_modules/prml/linear/regression.html#Regression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.regression.Regression" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Base class for regressors</p>
</dd></dl>

</div>
<div class="section" id="module-prml.linear.ridge_regression">
<span id="prml-linear-ridge-regression-module"></span><h2>prml.linear.ridge_regression module<a class="headerlink" href="#module-prml.linear.ridge_regression" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="prml.linear.ridge_regression.RidgeRegression">
<em class="property">class </em><code class="descclassname">prml.linear.ridge_regression.</code><code class="descname">RidgeRegression</code><span class="sig-paren">(</span><em>alpha: float = 1.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/ridge_regression.html#RidgeRegression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.ridge_regression.RidgeRegression" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.regression.Regression" title="prml.linear.regression.Regression"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.regression.Regression</span></code></a></p>
<p>Ridge regression model</p>
<p>w* = argmin <a href="#id5"><span class="problematic" id="id6">|t - X &#64; w|</span></a> + alpha * <a href="#id1"><span class="problematic" id="id2">|</span></a>w|_2^2</p>
<dl class="method">
<dt id="prml.linear.ridge_regression.RidgeRegression.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/ridge_regression.html#RidgeRegression.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.ridge_regression.RidgeRegression.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>maximum a posteriori estimation of parameter</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training data independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – training data dependent variable</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.ridge_regression.RidgeRegression.predict">
<code class="descname">predict</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/ridge_regression.html#RidgeRegression.predict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.ridge_regression.RidgeRegression.predict" title="Permalink to this definition">¶</a></dt>
<dd><p>make prediction given input</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – samples to predict their output</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">prediction of each input</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N,) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-prml.linear.softmax_regression">
<span id="prml-linear-softmax-regression-module"></span><h2>prml.linear.softmax_regression module<a class="headerlink" href="#module-prml.linear.softmax_regression" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="prml.linear.softmax_regression.SoftmaxRegression">
<em class="property">class </em><code class="descclassname">prml.linear.softmax_regression.</code><code class="descname">SoftmaxRegression</code><a class="reference internal" href="_modules/prml/linear/softmax_regression.html#SoftmaxRegression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.softmax_regression.SoftmaxRegression" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.classifier.Classifier" title="prml.linear.classifier.Classifier"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.classifier.Classifier</span></code></a></p>
<p>Softmax regression model
aka
multinomial logistic regression,
multiclass logistic regression,
maximum entropy classifier.</p>
<p>y = softmax(X &#64; W)
t ~ Categorical(t|y)</p>
<dl class="method">
<dt id="prml.linear.softmax_regression.SoftmaxRegression.classify">
<code class="descname">classify</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/softmax_regression.html#SoftmaxRegression.classify"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.softmax_regression.SoftmaxRegression.classify" title="Permalink to this definition">¶</a></dt>
<dd><p>classify input data</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – independent variable to be classified</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">class index for each input</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N,) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.softmax_regression.SoftmaxRegression.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em>, <em>max_iter: int = 100</em>, <em>learning_rate: float = 0.1</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/softmax_regression.html#SoftmaxRegression.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.softmax_regression.SoftmaxRegression.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>maximum likelihood estimation of the parameter</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) or </em><em>(</em><em>N</em><em>, </em><em>K</em><em>) </em><em>np.ndarray</em>) – training dependent variable
in class index or one-of-k encoding</li>
<li><strong>max_iter</strong> (<em>int</em><em>, </em><em>optional</em>) – maximum number of iteration (the default is 100)</li>
<li><strong>learning_rate</strong> (<em>float</em><em>, </em><em>optional</em>) – learning rate of gradient descent (the default is 0.1)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.softmax_regression.SoftmaxRegression.proba">
<code class="descname">proba</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/softmax_regression.html#SoftmaxRegression.proba"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.softmax_regression.SoftmaxRegression.proba" title="Permalink to this definition">¶</a></dt>
<dd><p>compute probability of input belonging each class</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – independent variable</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">probability of each class</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N, K) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-prml.linear.variational_linear_regression">
<span id="prml-linear-variational-linear-regression-module"></span><h2>prml.linear.variational_linear_regression module<a class="headerlink" href="#module-prml.linear.variational_linear_regression" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="prml.linear.variational_linear_regression.VariationalLinearRegression">
<em class="property">class </em><code class="descclassname">prml.linear.variational_linear_regression.</code><code class="descname">VariationalLinearRegression</code><span class="sig-paren">(</span><em>beta: float = 1.0</em>, <em>a0: float = 1.0</em>, <em>b0: float = 1.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/variational_linear_regression.html#VariationalLinearRegression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.variational_linear_regression.VariationalLinearRegression" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.regression.Regression" title="prml.linear.regression.Regression"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.regression.Regression</span></code></a></p>
<p>variational bayesian estimation of linear regression model
p(w,alpha|X,t)
~ q(w)q(alpha)
= N(w|w_mean, w_var)Gamma(alpha|a,b)</p>
<dl class="attribute">
<dt id="prml.linear.variational_linear_regression.VariationalLinearRegression.a">
<code class="descname">a</code><a class="headerlink" href="#prml.linear.variational_linear_regression.VariationalLinearRegression.a" title="Permalink to this definition">¶</a></dt>
<dd><p>a parameter of variational posterior gamma distribution</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">float</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="prml.linear.variational_linear_regression.VariationalLinearRegression.b">
<code class="descname">b</code><a class="headerlink" href="#prml.linear.variational_linear_regression.VariationalLinearRegression.b" title="Permalink to this definition">¶</a></dt>
<dd><p>another parameter of variational posterior gamma distribution</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">float</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="prml.linear.variational_linear_regression.VariationalLinearRegression.w_mean">
<code class="descname">w_mean</code><a class="headerlink" href="#prml.linear.variational_linear_regression.VariationalLinearRegression.w_mean" title="Permalink to this definition">¶</a></dt>
<dd><p>mean of variational posterior gaussian distribution</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">(n_features,) ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="prml.linear.variational_linear_regression.VariationalLinearRegression.w_var">
<code class="descname">w_var</code><a class="headerlink" href="#prml.linear.variational_linear_regression.VariationalLinearRegression.w_var" title="Permalink to this definition">¶</a></dt>
<dd><p>variance of variational posterior gaussian distribution</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">(n_features, n_feautures) ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="prml.linear.variational_linear_regression.VariationalLinearRegression.n_iter">
<code class="descname">n_iter</code><a class="headerlink" href="#prml.linear.variational_linear_regression.VariationalLinearRegression.n_iter" title="Permalink to this definition">¶</a></dt>
<dd><p>number of iterations performed</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">int</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.variational_linear_regression.VariationalLinearRegression.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em>, <em>iter_max: int = 100</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/variational_linear_regression.html#VariationalLinearRegression.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.variational_linear_regression.VariationalLinearRegression.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>variational bayesian estimation of parameter</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – training dependent variable</li>
<li><strong>iter_max</strong> (<em>int</em><em>, </em><em>optional</em>) – maximum number of iteration (the default is 100)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.variational_linear_regression.VariationalLinearRegression.predict">
<code class="descname">predict</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>return_std: bool = False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/variational_linear_regression.html#VariationalLinearRegression.predict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.variational_linear_regression.VariationalLinearRegression.predict" title="Permalink to this definition">¶</a></dt>
<dd><p>make prediction of input</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – independent variable</li>
<li><strong>return_std</strong> (<em>bool</em><em>, </em><em>optional</em>) – return standard deviation of predictive distribution if True
(the default is False)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><ul class="simple">
<li><strong>y</strong> (<em>(N,) np.ndarray</em>) – mean of predictive distribution</li>
<li><strong>y_std</strong> (<em>(N,) np.ndarray</em>) – standard deviation of predictive distribution</li>
</ul>
</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-prml.linear.variational_logistic_regression">
<span id="prml-linear-variational-logistic-regression-module"></span><h2>prml.linear.variational_logistic_regression module<a class="headerlink" href="#module-prml.linear.variational_logistic_regression" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="prml.linear.variational_logistic_regression.VariationalLogisticRegression">
<em class="property">class </em><code class="descclassname">prml.linear.variational_logistic_regression.</code><code class="descname">VariationalLogisticRegression</code><span class="sig-paren">(</span><em>alpha: float = None</em>, <em>a0: float = 1.0</em>, <em>b0: float = 1.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/variational_logistic_regression.html#VariationalLogisticRegression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.variational_logistic_regression.VariationalLogisticRegression" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.logistic_regression.LogisticRegression" title="prml.linear.logistic_regression.LogisticRegression"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.logistic_regression.LogisticRegression</span></code></a></p>
<dl class="attribute">
<dt id="prml.linear.variational_logistic_regression.VariationalLogisticRegression.alpha">
<code class="descname">alpha</code><a class="headerlink" href="#prml.linear.variational_logistic_regression.VariationalLogisticRegression.alpha" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="prml.linear.variational_logistic_regression.VariationalLogisticRegression.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em>, <em>iter_max: int = 1000</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/variational_logistic_regression.html#VariationalLogisticRegression.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.variational_logistic_regression.VariationalLogisticRegression.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>variational bayesian estimation of the parameter</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – training dependent variable</li>
<li><strong>iter_max</strong> (<em>int</em><em>, </em><em>optional</em>) – maximum number of iteration (the default is 1000)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.variational_logistic_regression.VariationalLogisticRegression.proba">
<code class="descname">proba</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/variational_logistic_regression.html#VariationalLogisticRegression.proba"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.variational_logistic_regression.VariationalLogisticRegression.proba" title="Permalink to this definition">¶</a></dt>
<dd><p>compute probability of input belonging class 1</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training data independent variable</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">probability of positive</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N,) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-prml.linear">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-prml.linear" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="prml.linear.BayesianLogisticRegression">
<em class="property">class </em><code class="descclassname">prml.linear.</code><code class="descname">BayesianLogisticRegression</code><span class="sig-paren">(</span><em>alpha: float = 1.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/bayesian_logistic_regression.html#BayesianLogisticRegression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.BayesianLogisticRegression" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.logistic_regression.LogisticRegression" title="prml.linear.logistic_regression.LogisticRegression"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.logistic_regression.LogisticRegression</span></code></a></p>
<p>Logistic regression model</p>
<p>w ~ Gaussian(0, alpha^(-1)I)
y = sigmoid(X &#64; w)
t ~ Bernoulli(t|y)</p>
<dl class="method">
<dt id="prml.linear.BayesianLogisticRegression.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em>, <em>max_iter: int = 100</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/bayesian_logistic_regression.html#BayesianLogisticRegression.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.BayesianLogisticRegression.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>bayesian estimation of logistic regression model
using Laplace approximation</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training data independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – training data dependent variable
binary 0 or 1</li>
<li><strong>max_iter</strong> (<em>int</em><em>, </em><em>optional</em>) – maximum number of paramter update iteration (the default is 100)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.BayesianLogisticRegression.proba">
<code class="descname">proba</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/bayesian_logistic_regression.html#BayesianLogisticRegression.proba"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.BayesianLogisticRegression.proba" title="Permalink to this definition">¶</a></dt>
<dd><p>compute probability of input belonging class 1</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training data independent variable</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">probability of positive</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N,) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="prml.linear.BayesianRegression">
<em class="property">class </em><code class="descclassname">prml.linear.</code><code class="descname">BayesianRegression</code><span class="sig-paren">(</span><em>alpha: float = 1.0</em>, <em>beta: float = 1.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/bayesian_regression.html#BayesianRegression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.BayesianRegression" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.regression.Regression" title="prml.linear.regression.Regression"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.regression.Regression</span></code></a></p>
<p>Bayesian regression model</p>
<p>w ~ N(w|0, alpha^(-1)I)
y = X &#64; w
t ~ N(t|X &#64; w, beta^(-1))</p>
<dl class="method">
<dt id="prml.linear.BayesianRegression.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/bayesian_regression.html#BayesianRegression.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.BayesianRegression.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>bayesian update of parameters given training dataset</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>n_features</em><em>) </em><em>np.ndarray</em>) – training data independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – training data dependent variable</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.BayesianRegression.predict">
<code class="descname">predict</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>return_std: bool = False</em>, <em>sample_size: int = None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/bayesian_regression.html#BayesianRegression.predict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.BayesianRegression.predict" title="Permalink to this definition">¶</a></dt>
<dd><p>return mean (and standard deviation) of predictive distribution</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>n_features</em><em>) </em><em>np.ndarray</em>) – independent variable</li>
<li><strong>return_std</strong> (<em>bool</em><em>, </em><em>optional</em>) – flag to return standard deviation (the default is False)</li>
<li><strong>sample_size</strong> (<em>int</em><em>, </em><em>optional</em>) – number of samples to draw from the predictive distribution
(the default is None, no sampling from the distribution)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><ul class="simple">
<li><strong>y</strong> (<em>(N,) np.ndarray</em>) – mean of the predictive distribution</li>
<li><strong>y_std</strong> (<em>(N,) np.ndarray</em>) – standard deviation of the predictive distribution</li>
<li><strong>y_sample</strong> (<em>(N, sample_size) np.ndarray</em>) – samples from the predictive distribution</li>
</ul>
</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="prml.linear.EmpiricalBayesRegression">
<em class="property">class </em><code class="descclassname">prml.linear.</code><code class="descname">EmpiricalBayesRegression</code><span class="sig-paren">(</span><em>alpha: float = 1.0</em>, <em>beta: float = 1.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/emprical_bayes_regression.html#EmpiricalBayesRegression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.EmpiricalBayesRegression" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.bayesian_regression.BayesianRegression" title="prml.linear.bayesian_regression.BayesianRegression"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.bayesian_regression.BayesianRegression</span></code></a></p>
<p>Empirical Bayes Regression model
a.k.a.
type 2 maximum likelihood,
generalized maximum likelihood,
evidence approximation</p>
<p>w ~ N(w|0, alpha^(-1)I)
y = X &#64; w
t ~ N(t|X &#64; w, beta^(-1))
evidence function p(t|X,alpha,beta) = S p(t|w;X,beta)p(w|0;alpha) dw</p>
<dl class="method">
<dt id="prml.linear.EmpiricalBayesRegression.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em>, <em>max_iter: int = 100</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/emprical_bayes_regression.html#EmpiricalBayesRegression.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.EmpiricalBayesRegression.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>maximization of evidence function with respect to
the hyperparameters alpha and beta given training dataset</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – training dependent variable</li>
<li><strong>max_iter</strong> (<em>int</em>) – maximum number of iteration</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.EmpiricalBayesRegression.log_evidence">
<code class="descname">log_evidence</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/emprical_bayes_regression.html#EmpiricalBayesRegression.log_evidence"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.EmpiricalBayesRegression.log_evidence" title="Permalink to this definition">¶</a></dt>
<dd><p>logarithm or the evidence function</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – indenpendent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – dependent variable</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">log evidence</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">float</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="prml.linear.LeastSquaresClassifier">
<em class="property">class </em><code class="descclassname">prml.linear.</code><code class="descname">LeastSquaresClassifier</code><span class="sig-paren">(</span><em>W: numpy.ndarray = None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/least_squares_classifier.html#LeastSquaresClassifier"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.LeastSquaresClassifier" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.classifier.Classifier" title="prml.linear.classifier.Classifier"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.classifier.Classifier</span></code></a></p>
<p>Least squares classifier model</p>
<p>X : (N, D)
W : (D, K)
y = argmax_k X &#64; W</p>
<dl class="method">
<dt id="prml.linear.LeastSquaresClassifier.classify">
<code class="descname">classify</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/least_squares_classifier.html#LeastSquaresClassifier.classify"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.LeastSquaresClassifier.classify" title="Permalink to this definition">¶</a></dt>
<dd><p>classify input data</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – independent variable to be classified</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">class index for each input</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N,) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.LeastSquaresClassifier.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/least_squares_classifier.html#LeastSquaresClassifier.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.LeastSquaresClassifier.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>least squares fitting for classification</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) or </em><em>(</em><em>N</em><em>, </em><em>K</em><em>) </em><em>np.ndarray</em>) – training dependent variable
in class index (N,) or one-of-k coding (N,K)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="prml.linear.LinearRegression">
<em class="property">class </em><code class="descclassname">prml.linear.</code><code class="descname">LinearRegression</code><a class="reference internal" href="_modules/prml/linear/linear_regression.html#LinearRegression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.LinearRegression" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.regression.Regression" title="prml.linear.regression.Regression"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.regression.Regression</span></code></a></p>
<p>Linear regression model
y = X &#64; w
t ~ N(t|X &#64; w, var)</p>
<dl class="method">
<dt id="prml.linear.LinearRegression.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/linear_regression.html#LinearRegression.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.LinearRegression.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>perform least squares fitting</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – training dependent variable</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.LinearRegression.predict">
<code class="descname">predict</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>return_std: bool = False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/linear_regression.html#LinearRegression.predict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.LinearRegression.predict" title="Permalink to this definition">¶</a></dt>
<dd><p>make prediction given input</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – samples to predict their output</li>
<li><strong>return_std</strong> (<em>bool</em><em>, </em><em>optional</em>) – returns standard deviation of each predition if True</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><ul class="simple">
<li><strong>y</strong> (<em>(N,) np.ndarray</em>) – prediction of each sample</li>
<li><strong>y_std</strong> (<em>(N,) np.ndarray</em>) – standard deviation of each predition</li>
</ul>
</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="prml.linear.FishersLinearDiscriminant">
<em class="property">class </em><code class="descclassname">prml.linear.</code><code class="descname">FishersLinearDiscriminant</code><span class="sig-paren">(</span><em>w: numpy.ndarray = None</em>, <em>threshold: float = None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/fishers_linear_discriminant.html#FishersLinearDiscriminant"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.FishersLinearDiscriminant" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.classifier.Classifier" title="prml.linear.classifier.Classifier"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.classifier.Classifier</span></code></a></p>
<p>Fisher’s Linear discriminant model</p>
<dl class="method">
<dt id="prml.linear.FishersLinearDiscriminant.classify">
<code class="descname">classify</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/fishers_linear_discriminant.html#FishersLinearDiscriminant.classify"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.FishersLinearDiscriminant.classify" title="Permalink to this definition">¶</a></dt>
<dd><p>classify input data</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – independent variable to be classified</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">binary class for each input</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N,) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.FishersLinearDiscriminant.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/fishers_linear_discriminant.html#FishersLinearDiscriminant.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.FishersLinearDiscriminant.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>estimate parameter given training dataset</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training dataset independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – training dataset dependent variable
binary 0 or 1</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.FishersLinearDiscriminant.transform">
<code class="descname">transform</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/fishers_linear_discriminant.html#FishersLinearDiscriminant.transform"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.FishersLinearDiscriminant.transform" title="Permalink to this definition">¶</a></dt>
<dd><p>project data</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – independent variable</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><strong>y</strong> – projected data</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N,) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="prml.linear.LogisticRegression">
<em class="property">class </em><code class="descclassname">prml.linear.</code><code class="descname">LogisticRegression</code><a class="reference internal" href="_modules/prml/linear/logistic_regression.html#LogisticRegression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.LogisticRegression" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.classifier.Classifier" title="prml.linear.classifier.Classifier"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.classifier.Classifier</span></code></a></p>
<p>Logistic regression model</p>
<p>y = sigmoid(X &#64; w)
t ~ Bernoulli(t|y)</p>
<dl class="method">
<dt id="prml.linear.LogisticRegression.classify">
<code class="descname">classify</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>threshold: float = 0.5</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/logistic_regression.html#LogisticRegression.classify"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.LogisticRegression.classify" title="Permalink to this definition">¶</a></dt>
<dd><p>classify input data</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – independent variable to be classified</li>
<li><strong>threshold</strong> (<em>float</em><em>, </em><em>optional</em>) – threshold of binary classification (default is 0.5)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">binary class for each input</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">(N,) np.ndarray</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.LogisticRegression.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em>, <em>max_iter: int = 100</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/logistic_regression.html#LogisticRegression.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.LogisticRegression.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>maximum likelihood estimation of logistic regression model</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training data independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – training data dependent variable
binary 0 or 1</li>
<li><strong>max_iter</strong> (<em>int</em><em>, </em><em>optional</em>) – maximum number of paramter update iteration (the default is 100)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.LogisticRegression.proba">
<code class="descname">proba</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/logistic_regression.html#LogisticRegression.proba"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.LogisticRegression.proba" title="Permalink to this definition">¶</a></dt>
<dd><p>compute probability of input belonging class 1</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training data independent variable</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">probability of positive</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N,) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="prml.linear.Perceptron">
<em class="property">class </em><code class="descclassname">prml.linear.</code><code class="descname">Perceptron</code><a class="reference internal" href="_modules/prml/linear/perceptron.html#Perceptron"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.Perceptron" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.classifier.Classifier" title="prml.linear.classifier.Classifier"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.classifier.Classifier</span></code></a></p>
<p>Perceptron model</p>
<dl class="method">
<dt id="prml.linear.Perceptron.classify">
<code class="descname">classify</code><span class="sig-paren">(</span><em>X</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/perceptron.html#Perceptron.classify"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.Perceptron.classify" title="Permalink to this definition">¶</a></dt>
<dd><p>classify input data</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – independent variable to be classified</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">binary class (-1 or 1) for each input</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N,) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.Perceptron.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X</em>, <em>t</em>, <em>max_epoch=100</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/perceptron.html#Perceptron.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.Perceptron.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>fit perceptron model on given input pair</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>)</em>) – training dependent variable
binary -1 or 1</li>
<li><strong>max_epoch</strong> (<em>int</em><em>, </em><em>optional</em>) – maximum number of epoch (the default is 100)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="prml.linear.RidgeRegression">
<em class="property">class </em><code class="descclassname">prml.linear.</code><code class="descname">RidgeRegression</code><span class="sig-paren">(</span><em>alpha: float = 1.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/ridge_regression.html#RidgeRegression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.RidgeRegression" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.regression.Regression" title="prml.linear.regression.Regression"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.regression.Regression</span></code></a></p>
<p>Ridge regression model</p>
<p>w* = argmin <a href="#id7"><span class="problematic" id="id8">|t - X &#64; w|</span></a> + alpha * <a href="#id3"><span class="problematic" id="id4">|</span></a>w|_2^2</p>
<dl class="method">
<dt id="prml.linear.RidgeRegression.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/ridge_regression.html#RidgeRegression.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.RidgeRegression.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>maximum a posteriori estimation of parameter</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training data independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – training data dependent variable</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.RidgeRegression.predict">
<code class="descname">predict</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/ridge_regression.html#RidgeRegression.predict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.RidgeRegression.predict" title="Permalink to this definition">¶</a></dt>
<dd><p>make prediction given input</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – samples to predict their output</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">prediction of each input</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N,) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="prml.linear.SoftmaxRegression">
<em class="property">class </em><code class="descclassname">prml.linear.</code><code class="descname">SoftmaxRegression</code><a class="reference internal" href="_modules/prml/linear/softmax_regression.html#SoftmaxRegression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.SoftmaxRegression" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.classifier.Classifier" title="prml.linear.classifier.Classifier"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.classifier.Classifier</span></code></a></p>
<p>Softmax regression model
aka
multinomial logistic regression,
multiclass logistic regression,
maximum entropy classifier.</p>
<p>y = softmax(X &#64; W)
t ~ Categorical(t|y)</p>
<dl class="method">
<dt id="prml.linear.SoftmaxRegression.classify">
<code class="descname">classify</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/softmax_regression.html#SoftmaxRegression.classify"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.SoftmaxRegression.classify" title="Permalink to this definition">¶</a></dt>
<dd><p>classify input data</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – independent variable to be classified</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">class index for each input</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N,) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.SoftmaxRegression.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em>, <em>max_iter: int = 100</em>, <em>learning_rate: float = 0.1</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/softmax_regression.html#SoftmaxRegression.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.SoftmaxRegression.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>maximum likelihood estimation of the parameter</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) or </em><em>(</em><em>N</em><em>, </em><em>K</em><em>) </em><em>np.ndarray</em>) – training dependent variable
in class index or one-of-k encoding</li>
<li><strong>max_iter</strong> (<em>int</em><em>, </em><em>optional</em>) – maximum number of iteration (the default is 100)</li>
<li><strong>learning_rate</strong> (<em>float</em><em>, </em><em>optional</em>) – learning rate of gradient descent (the default is 0.1)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.SoftmaxRegression.proba">
<code class="descname">proba</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/softmax_regression.html#SoftmaxRegression.proba"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.SoftmaxRegression.proba" title="Permalink to this definition">¶</a></dt>
<dd><p>compute probability of input belonging each class</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – independent variable</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">probability of each class</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N, K) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="prml.linear.VariationalLinearRegression">
<em class="property">class </em><code class="descclassname">prml.linear.</code><code class="descname">VariationalLinearRegression</code><span class="sig-paren">(</span><em>beta: float = 1.0</em>, <em>a0: float = 1.0</em>, <em>b0: float = 1.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/variational_linear_regression.html#VariationalLinearRegression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.VariationalLinearRegression" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.regression.Regression" title="prml.linear.regression.Regression"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.regression.Regression</span></code></a></p>
<p>variational bayesian estimation of linear regression model
p(w,alpha|X,t)
~ q(w)q(alpha)
= N(w|w_mean, w_var)Gamma(alpha|a,b)</p>
<dl class="attribute">
<dt id="prml.linear.VariationalLinearRegression.a">
<code class="descname">a</code><a class="headerlink" href="#prml.linear.VariationalLinearRegression.a" title="Permalink to this definition">¶</a></dt>
<dd><p>a parameter of variational posterior gamma distribution</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">float</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="prml.linear.VariationalLinearRegression.b">
<code class="descname">b</code><a class="headerlink" href="#prml.linear.VariationalLinearRegression.b" title="Permalink to this definition">¶</a></dt>
<dd><p>another parameter of variational posterior gamma distribution</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">float</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="prml.linear.VariationalLinearRegression.w_mean">
<code class="descname">w_mean</code><a class="headerlink" href="#prml.linear.VariationalLinearRegression.w_mean" title="Permalink to this definition">¶</a></dt>
<dd><p>mean of variational posterior gaussian distribution</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">(n_features,) ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="prml.linear.VariationalLinearRegression.w_var">
<code class="descname">w_var</code><a class="headerlink" href="#prml.linear.VariationalLinearRegression.w_var" title="Permalink to this definition">¶</a></dt>
<dd><p>variance of variational posterior gaussian distribution</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">(n_features, n_feautures) ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="prml.linear.VariationalLinearRegression.n_iter">
<code class="descname">n_iter</code><a class="headerlink" href="#prml.linear.VariationalLinearRegression.n_iter" title="Permalink to this definition">¶</a></dt>
<dd><p>number of iterations performed</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">int</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.VariationalLinearRegression.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em>, <em>iter_max: int = 100</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/variational_linear_regression.html#VariationalLinearRegression.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.VariationalLinearRegression.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>variational bayesian estimation of parameter</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – training dependent variable</li>
<li><strong>iter_max</strong> (<em>int</em><em>, </em><em>optional</em>) – maximum number of iteration (the default is 100)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.VariationalLinearRegression.predict">
<code class="descname">predict</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>return_std: bool = False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/variational_linear_regression.html#VariationalLinearRegression.predict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.VariationalLinearRegression.predict" title="Permalink to this definition">¶</a></dt>
<dd><p>make prediction of input</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – independent variable</li>
<li><strong>return_std</strong> (<em>bool</em><em>, </em><em>optional</em>) – return standard deviation of predictive distribution if True
(the default is False)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><ul class="simple">
<li><strong>y</strong> (<em>(N,) np.ndarray</em>) – mean of predictive distribution</li>
<li><strong>y_std</strong> (<em>(N,) np.ndarray</em>) – standard deviation of predictive distribution</li>
</ul>
</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="prml.linear.VariationalLogisticRegression">
<em class="property">class </em><code class="descclassname">prml.linear.</code><code class="descname">VariationalLogisticRegression</code><span class="sig-paren">(</span><em>alpha: float = None</em>, <em>a0: float = 1.0</em>, <em>b0: float = 1.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/variational_logistic_regression.html#VariationalLogisticRegression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.VariationalLogisticRegression" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#prml.linear.logistic_regression.LogisticRegression" title="prml.linear.logistic_regression.LogisticRegression"><code class="xref py py-class docutils literal notranslate"><span class="pre">prml.linear.logistic_regression.LogisticRegression</span></code></a></p>
<dl class="attribute">
<dt id="prml.linear.VariationalLogisticRegression.alpha">
<code class="descname">alpha</code><a class="headerlink" href="#prml.linear.VariationalLogisticRegression.alpha" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="prml.linear.VariationalLogisticRegression.fit">
<code class="descname">fit</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em>, <em>t: numpy.ndarray</em>, <em>iter_max: int = 1000</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/variational_logistic_regression.html#VariationalLogisticRegression.fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.VariationalLogisticRegression.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>variational bayesian estimation of the parameter</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training independent variable</li>
<li><strong>t</strong> (<em>(</em><em>N</em><em>,</em><em>) </em><em>np.ndarray</em>) – training dependent variable</li>
<li><strong>iter_max</strong> (<em>int</em><em>, </em><em>optional</em>) – maximum number of iteration (the default is 1000)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="prml.linear.VariationalLogisticRegression.proba">
<code class="descname">proba</code><span class="sig-paren">(</span><em>X: numpy.ndarray</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/prml/linear/variational_logistic_regression.html#VariationalLogisticRegression.proba"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#prml.linear.VariationalLogisticRegression.proba" title="Permalink to this definition">¶</a></dt>
<dd><p>compute probability of input belonging class 1</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>X</strong> (<em>(</em><em>N</em><em>, </em><em>D</em><em>) </em><em>np.ndarray</em>) – training data independent variable</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">probability of positive</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">(N,) np.ndarray</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
</div>


           </div>
           
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="prml.markov.html" class="btn btn-neutral float-right" title="prml.markov package" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="prml.kernel.html" class="btn btn-neutral float-left" title="prml.kernel package" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2019, Author

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>